﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace Common.Particles
{
    public class FireParticleSystem2D : ParticleSystem2D
    {
        protected int m_maxParticleLife = 1000; //10 seconds
        protected int m_minParticleLife = 100; //1 second        

        protected int m_minXVelocity = -1;
        protected int m_minYVelocity = -4;

        protected int m_maxXVelocity = 1;
        protected int m_maxYVelocity = 0;

        protected int m_minXVelocityNoise = -2;
        protected int m_minYVelocityNoise = -0;

        protected int m_maxXVelocity_noise = 2;
        protected int m_maxYVelocity_noise = -0;


        public FireParticleSystem2D(Texture2D texture, Vector2 position)
            : base (texture, position, false, 0)
        {
            m_updateFrequency = 70;
            m_nbParticlesPerUpdate = 3;
        }

        protected override void SetCurrentParticleParameters(ref Particle2D particle)
        {
            base.SetCurrentParticleParameters(ref particle);            
            particle.Mass = 0;            
            particle.Position = m_psPosition;
            particle.Life = m_random.Next(m_minParticleLife, m_maxParticleLife);
            particle.Velocity = new Vector2(m_random.Next(m_minXVelocity, m_maxXVelocity), m_random.Next(m_minYVelocity, m_maxYVelocity));
        }
    }
}
